fixing bugs introduced in last commit