cast to object first when casting to detachable