throw meaningful exception instead of NullPointerException