try to handle non-existent indexes properly