add atomic write method and remove activesupport dependency