Fix db timeout bug