Added system include directories. Fixed a few bugs.