added the error stack trace, added the dirty fix for the empty arrays