now checking in both write functions