Fix timeout not firing when error occurs