Fixes for build errors and warnings