moved trigger to the external input
exit if read fails