fix issues reported by Salva
Merge pull request #16 from alexm/reported-by-salva

fix issues reported by Salva 
Let's see if we finish this today.