fixed bug with max delta