fixed repeat jquery script that was causing bugs