fixed bugs introduced in last commit