fixed compilation
fixed crashes due to max cash size computation (triggered on 8GB RAM)