little bug fixes, i think the thing works now...