Fix exception for box shapes (Fixes #1580)