NullPointerException fix on create