Solved many other bugs. Code is dirty now, it will be cleaned after all known bugs are removed.