Fix ordering of attaching callbacks.