fixes bugs introduced in last commit