coredump by duplicate variables fixed