fix space and special character in output path and bugs for grid calculation when lga is too small