Fix NPE

as suggested by Christopher Supnig