Integration tests + fixes for found bugs