fix bugs, add boolean flag to identify coercion variables