fixed register function;