added save sequence atomic operation and made other atomic operations a little more robust