BUG Fix integer check

The previous version did not even pass unit tests