Fixed compiling errors.

By switching the order of class definitions.