fixing stack issues