Fixed toEvents method to avoid generation lists with one empty element on empty properties.