Fixing a bug in the registeration