switch ref for atomic boolean: fixes #1