Small fix

This should fix your problem. 
You have to read the fix and may be try it in a debug mode to understand it better.