fixed bug caused by java optimisation