remove unnecessary space characters