Fixed bug that would produce erroneous behavior when overwriting class definitions in the 'register'function.