Fixed crash when monitoring file.
Replace deprecated function.