fixed includes + minor issues in MinGW build