BUGFIX: cleanup func was releasing wrong handle
More nicer error handling
Nicer error messages