Template fix
CMakeLists and some small fixes