Improved array check