Fixes overflow bug