problem with stack implementation