added functionality to use objects with number keys for arrays