add test for output and fix before array