Fix NPE part of #197