#50 fixed comparing function