be a bit more smart at detecting buffer change