fixed stack empty function