check if can remove the synchronized block