Fixed some bugs not taking settings into account.
Merge.