fix compile error and warnings