invert some if conditions to match code style better