add better error support