minor bug fixes and additional tests