added a little synchronization