some fixes for bugs introduced in last commit