fixing bugs
fix all bugs reported in testing results by Ahmad