modified a few code mistakes