Fixed the crashes from access to empty container