fix complexity codes. use "===", fix undefined var, and more