various bugfixes

* get rid of enif_make_badarg() cause it simply returns 0
* more informative error messages
* a lot of bugfixes