fix cannot lookup index 0 of undefined