added necessary synchronization blocks to prevent errors like "method called after release()"