Protect against empty lists, fix map interaction