fixing bugs, minor modifications