Fix NullPointerException if no instance is returned