Fix clutter up class string, fixes #593
More test cases for buildClassName() as suggested by @isagalaev