squash npe
fix #801 by improving error message