Fix the situation with polygon and line properly.