Fix some bugs and adjust some things.