Fixed an issue that would cause NPE