fixes for compile under CYGWIN

Signed-off-by: Yucong Sun <sunyucong@gmail.com>