Fixes some style issues, and a NPE.