Fixed #39

The error was due to accessing an event id which might not be present in the actual database.