changing non-atomic clear to atomic and