initialize variables and check index existence, making isue #21 happy again