fix openmp bug, other tweaks and fixes