Fix substitute custom types.

Add NewEvent and NewListener functions.