fixed some build errors and warnings. removed trailing whitespaces.