Added error handling to list images