Fix bug in retrieving schedule