Corrected bugs: ErrorException: Undefined index: running ErrorException: Invalid argument supplied for foreach()