fixed undefined indexies