fixed array sorting bug in works