Fix cast exception with queue