more error handling for bad APIs