Fix potential edge case bug.

How awesome is to recognize this without the need of actually incurring in the
bug and spending hours debugging this mess? :trollface: