Fix index out of bounds that caused memory issues related to fish on multiple terminals