fixes NullPointerException; closes #6