Fixes various bugs in method registration.