fixing some lingering bugs in stack selection