javascript: fix compares