resolved almost all bugs