fixed potential out of range error on waterfall