Fix build on Ubuntu 18.04
52479b36 broke the build for me on Ubuntu 18.04 LTS. This merge request makes the hacks marginally more robust by grepping for the lines we want to replace instead of replacing them by line numbers.
Tested on Debian 10, as well.
(See #7 (closed).)