bugfix in Stack
Modifications in database_tools.py to solve the problem