Fixed a lot of issues with or found by the system tests