Fixes a null pointer exception