Remove some bugs, reduce global-namespace filehandles