fix NPE (untested)