use references in container libraries (some problems still with swap)