Remove printStackTrace() to fix cast exception.