Small fixes and one giant bugfix.