replaced exit()-calls with assertions