Fix NPE on < 4.0. Closes #187