some bug fixes, still working