Fixed convert spaces functionality

Made changes to support proper functioning of the convert spaces flag.