Merge pull request #385 from 0hansen/master

Corrections and singleton pattern for java