logic bugfix