Fix a NPE and maven

This is a followup PR for PR#9 which has been manually merged for the most part.