Move error message initialization and add check for file monitor is Zero before unreffing