fix registration bugs