Lot of fixes from development branch for JEM 1.9.8 / 2.0

see the commits comments for details