Fixed many bugs. But there are still bugs.