Fixed NPE in IJGateway
removed several warnings + code-cleanup
More code-cleanup
more cleanup