fix #112  in a naive way

I found a fix, but it's a bit too naive for my taste, what do you think?