Fixed registration bugs