use select instead of fork, but with bug on dynamic