Fix mobile detect so session variable is correctly set