Fixed some signal handling issues that were visible on Ubuntu/Linux.