fixed possible null pointer exception