Fix handling runtime error when rake:restart