Fixed a bug regarding duplicate registration