Fixed seg fault when no records found + some bugs.
Merge pull request #44 from losgrandes/master

Fixed seg fault when no records found + some bugs.