Fixed crashing due to Object[] casting

This addresses the issue #15 I raised initially