fix coffee script logic