fix end in case