Fixed bug with overflow