fixes, better error handling