fixed exception, added additions check for values in stack