General bugfixes and *nix terminal detachment