Fixed many many bugs.