Improve Atomic tests and fix a bug.