fixed vars not cleared issue