Fixed some bugs in coffee script