added an error handler in ajax call which would call the refresh function fix #18