Fix bug with empty elements
Fix bug with inverted sections