Fixed exits and signal handling