fix behavior when max-width is not defined (replaces #18, fixes #29)

I rewrote pull request #18 to be against the unstable branch so it can be merged. This also fixes issue #29.