fix getData bug with API + provide more complete error msg