Fixed crashing due to Object[] casting

This addresses the issue I raised initially