Fixed a few bugs on Ubuntu 12.04.