refactor and fix weeks bug