Fix Issue 11: ternary operator results in a read-before-assignment bug