some bugfixes. Someday i'll be good at git *sigh*