Phase stability and magnetism in NiPt and NiPd alloys