fixed NPE in LIFO and fixed test cases