refine code for semantic cannot run