select fix and prime.c modification