Update logic.js

fix your bugs