merge NPE bugfix from v0.2