added a max delay when waiting for a better location and fixed reset bug in timeout error handler