fixed possible null pointer crash.