Fixing issue where preside terminal history causes JS errors and various problems. Limiting the number of history items to store in the hope of a fix