fixed the between function