Fix bugs in js controllers