bug fixed for merged code