Kostya fixed some bugs.