The threaded RTS had a fix for this a long time ago (#1623) but this patch applies a similar fix to the non-threaded RTS.