added try-catch for copy_magmom