Fix bugs in subscription timeout code