added backend timeout and bug fix when the backend returns an error