fixing some bugs inevitably introduced by the latest commit ;)