My question is clearly not a duplicate of this other one, because the solutions are completely different. Could somebody remove the [duplicate] mark?
I've removed the duplicate link.
I've also copied your edit into an answer in CW mode quoting your solution.
Either accept that as the answer, or post your own answer stating the same that you did to fix the problem so that you can accept that one as the answer.