changed custome dialog handling method