try using range instead of whole buffer