replaced fsync with dynamic fsync