More additions.

Fixed the fg/bg flag variable block (lines 186-193).
Corrected compiler errors.