Fix some compiler and linking errors