Fixed rare NPE when using Reflection class.

Could happen during shut down or when method was called on a
build host instead of the server.