fix syntax error and use extend