some fixes, including a bug fix