Added guard for coercing BasicObject into Integer