Fixed bug with array to string conversion in some cases