Thank you all i have fixed the problem. It was indeed the FIFO stack not being a proper array. Thanks.
Now i can move on and deal with real issues. I'm almost embarassed now to ask any other question after being told several times that the problem was with the Array.