System testing

System tests and bugfix.