cleanup array_merge and scalar check