fixed missing ends