Fix env buffer