add detect_instance_type_loose method
remove unused import