Fixed register bugs