fixed JAVA ACCESS VIOLATION EXCEPTION in JVM (1.7.0_07 < JVM version <=  1.7.0_25) and small memory leak