fixing bugs introduced in recent commit