Move the guard before the use of metaclass.

To avoid NPE/dead code, move the guard before the use of metaclass.