minor bug fixes and changes

still many bugs to fix