removed string comparison bug and fixed problem with mismatched type