Some fixes for last pull request

* Fixes for #25, #30, #31