Fix for a bug

Hi Alvaro, I'm sending you a little patch for a bug described in your comment...

Please review it and if you agree apply it in your master branch.

thanks