Fix bug when var is empty

This will close #6