fixed bug in extent calculation