converted swashata's fix from issues #11 to coffee script