fix the bug in recordEvent