Add more acceptance tests and fix bugs