Fixed NPE, as described in #6