fixes null pointer error