various fixes and improvements
fix random jvm crash