Fixed cast bug in Collection