fixes error when extending array