Fix a precedence issue. The logic is unchanged but 'ret' does not have the expected value. So the logged error message may be incorrect. + add some empty lines between functions