Fixed divide by zero bug in percent_rank and fixed bug in regression tests