Fixed error without sorting and getItems must return an array