fixing an issue with assignment vs compare