Fixed bug that wriote event data and event varaibles in a wrong way.