improved API2 support with better error handling