fixed bug with variable defined as "long" that should be "int" in EM engine