code review fix: synchronization  on boxed primitive and some minor changes