Fixing Some bugs