Fixing overflow problem