some fields had the wrong scope; minor if-stmt improvements. fixes #32