adding isBuffer check