support other shapes and fix bug in range calculation