fix bugs https://trello.com/c/LeZEcEoT/26-js