bugfixes galore, and file-less version for test