add missing factory code. fixed syntax error