fixed some corner cases when printing and no-js