Small fixes
Fixed error when lists were changed while iterating over them