fix segfault due to pulse input race condition
(cherry picked from commit be5167654153cad02f821decc39ad35cd239a6ed)