fixed bad coding bug