fixed undefined index by setting defaults