NullPointerException bugfix