EA-51458 NPE fixed + some cleaning
compatibility with IDEA 132.947