Fixes

Simple but important fixes required for portable builds.