Fixed bug with terminal character encoding not being detected correctly in all cases. Also fixed detection if setup needs to be run.