fixed a bug in register
Mikael and Malte