array: handle leading spaces correctly

use `.shift()` not `.pop()`!