Need help with a bug. Otherwise the endings are completed