Fixes null pointer exception