Fix bug copied from an old code base, thanks to Parisa for reporting it