add setting logic
bug fixing