Fixed an null pointer exception