Undefined index, undefined variable fixes