Fix several bugs concerned with different configurations.

9 files changed