protect foreach loop with isset
Merge branch 'develop' into 2.0dev