fix error in prime validation routine