correcting nullPointerException