updated scheduler file to catch errors