Added some tests from magic_deregister branch