Previous fix wasn't correct. This one is better