Update controller.js

Applied patch from tsimmons