@sash funny coincidence, I fixed the same class of bug at work recently