Fixed #229

I do some code refactoring and it fixes this :D