Fix #31 and other build errors & warnings