endrepeat model fix