fix issue where you order of elements would get messed