build fixes and cleanup