Fixed some mod function bugs and stat caps.