Add bugfixes from testing