fix null pointer error (still not working)