fixed logical bug