Fix bug in environment