Fixes the floating point exception issue

And some fixes in the interface

fixes #6