fixing bug with multiple nests