return None instead of -1 in case of invalid index