various fixes, extra checks