Started tests; bug fixes