resolved issue#5: added duplicate check