fix: use atomic boolean instead of synchronization