added check for non-finite step sizes