fixing Some Bugs