Fixing bug on setting initial gallery index