Fixed bug with registration