fixing register bug