null pointer exception bug fix