I assume your custom collate function should work. What kind of error message are you seeing using it?