Fixed two logic errors that were cancelling each other out.