Additional fixes over merge request #89

I have throughly reviewed and tested fonfon's dev branch changes requested for merge in #89. I felt that some fixes were required and I have made them.

Since the request has been pending for quite time and I have taken a good look at it, consider doing a merge without any further review.

I further propose that in future, in the interest of faster merges, a merge could happen if any one active developer reviews and okays the code submitted.