bugfix in register function