Fixing bugs (tested).