GEOS-6658 and a minor fix on the bound generator

Please read the following JIRA: https://jira.codehaus.org/browse/GEOS-6658.

Also the pull request contains a minor fix on the bounding box generation.