Fixed error checking in Register.
Martin