fix iterating on None error