Fixed register input, Register now correctly frees query result