Fixes for miscsorter and other scripts.