Switched instanceof to isBuffer