Fixed registration logic.