General bug fixes and more arrays to tuples