Fix problems with double-if