50% of the time it works everytime!
added debug output