fix start end logics