Add tests to cover issue #319
Fix bounds calculations
Fix some dependencies
Replace flet with cl-flet