lots of fixes, but still bugs