patched the small prime case