I agree with @chadrien. 

We should re-evaluate this method and consider refactoring and also beef up the tests to have more coverage to avoid bugs such as this in the future.