Fixed a lot of errors!

Fixed a lot of errors! merge it.