Added check of edge case of write method