Fixes shortString method for version <= 2.9

And move common code in CompilerUtils