Fixed problematic logic.