improved preferences handling