fixed bugs introduced through changes of the previous commit