fixed some bugs with registration