BUGFIX: several bugs fixed
BUGFIX: underestimated ternerity of JavaScript's loose typeing.