fixed bug

fixed a bug and added an ending