Fixed compilation errors on linux, ref #547
Eliminating warning for possibly uninitialized variable use
Merged wiredfool's changes.