Fixed session detection

The detection didn't work correctly, I still got "Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at ...".