Loop

@nan please review & merge

First commit fixes the specific bug you reported. Second commit cleans up a bit and fixes the block ID argument for the checkTimeout function.