Try to fix #58; also fix a bug in CMake