Fixed possible NullPointerException