fixed a subtle bug when returning arrays