added support for gap error