updated safe casting and array adding.
working on test_utilities.cpp