Fix possible NPE with GlassFish
Fix possible NPE
Better fix