stack implementation fixed