Fixed compile and linking errors