Fixes to allow GCC4.7 building
Combined code changes (trailblazerz)

Signed-off-by: Daniel Tarrant <daniel.g.tarrant@gmail.com>