fix some compilation warnings and errors