Fixed some bugs, rewrite OnLocationChanged method