Fixing SCons build system after merging in changes from trunk (WIP)