Fix for undefined index