fixed bug with withenv method