fixed a bug on registration