clean up

1. add CMKE_DL_LIBS at link time
2. code clean up