fix bug in mag_print (showing a value too large by 2^30); cleanup and test some mag methods