Fixed the logic of CLoopFunctions::PreStep() and CLoopFunctions::PostStep().

Now CLoopFunctions::PreStep() is executed before sense/control step, and CLoopFunctions::PostStep() is executed right after it.
Fixed minor compilation warning.