get rid of undefined index on saving