Compile fixes for Ubuntu 12.04 (gcc 4.6)