Solves the NPE reported in #366