added autodetection using geo-location

fixed also segmentation fault