fix compilation error and warnings