Fix handling of empty extensions
Better way to solve this + spec