fixed crash on invalid api.