Bug fix to database session expunge on None input