Glad you solved it? Was it the obvious one? Or some obscure code?
It was due to an incorrect order of function execution. I hard-coded it and lost track of everything when the functions were nested too much.