fixes null pointer exception