corrected logical bug (i hope)