Fixing up some bugs and adding compliance tests