Fixes of some bugs.