fixing overflow issues