Fixed bugs introduced in last two commits.