allow second argument to be a buffer