adds lifo tests and fix bug