fixed all bugs and errors

fixed all bugs and errors