Addresses #1165 In my testing, this appears to solve this problem and does not interfere with or alter normal behavior. I tried to keep code formatting consistent with original code.