Fixes signal handling. Should now work in Ruby 2.1 too.