Fix single variable case, add debug option (#4144)