using isset() to check if index is set to avoid that php warning spam error log