small fixes
added synchronized blocks