Resolve logic errors