various fixes to make code compile with gfortran