fix undefined errors;
fix recurrency misscount