Some bugs fixed.

Some bugs fixed and added an improved completion handler for
dismissWithCompletion: method.