fixed overflow bug, test updated