Spanclass fixes

This should fix the issues described in #4665 #4693 #4691 

Fixes #4665 Fixes #4693 Fixes #4691