Fix catch in atomic function.

Reset the atomic flag to its proper value after the catch.
Merge branch '1.4-stable'