Fix some obvious logic errors