finishing fixing bugs from last commit